<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
	  xmlns:p="http://primefaces.org/ui">

	<h:head><h1>Registrazione</h1>
		<link type="text/css" href="./generalstyle.css" rel="stylesheet"/>
	
	</h:head>
<body>
	<img src="http://www.phys.uniroma1.it/DipWeb/museo/registro.GIF" alt="" height="250" width="300"/>
		 <h:form>
        <p:menubar>  
                <p:menuitem value="Home" url="./home.xhtml" />  
				<p:menuitem value="Area Cliente" url="./cliente/homeCliente.xhtml" />
				<p:menuitem value="Area Impiegato" url="./impiegato/homeImpiegato.xhtml" /> 
				<p:menuitem value="Login" url="./login.xhtml" rendered="#{request.remoteUser == null}" />
                <p:menuitem value="Logout" actionListener="#{logoutManagedBean.logout()}" rendered="#{request.remoteUser != null}" />
		</p:menubar>
		</h:form>
	
	<h:form>
		<p:panel header="Registrazione"  style="width:600px; margin:0 auto; text-align:center;">
			<h:panelGrid columns="3" id="regGrid">

				<h:outputLabel for="username">User Name:</h:outputLabel>
				<p:inputText id="username" requiredMessage="Campo obbligatorio"
					value="#{RegistrazioneManagedBean.username}" required="true" />
				<p:message for="username" />

				<h:outputLabel for="password">Password:</h:outputLabel>
				<p:password id="password" feedback="true" match="pwd2" requiredMessage="Campo obbligatorio"
					value="#{RegistrazioneManagedBean.password}" required="true" />
				<p:message for="password" />
				
					<h:outputLabel for="pwd2">Conferma Password:</h:outputLabel>
				<p:password id="pwd2" label="Conferma Password" requiredMessage="Campo obbligatorio" required="true"
				 value="#{RegistrazioneManagedBean.password}"/>
					<p:message for="pwd2" />
	
				<h:outputLabel for="email">Email:</h:outputLabel>
				<p:inputText id="email" required="true" label="email "
					requiredMessage="Campo obbligatorio"
					validatorMessage="formato email non valido"
					value="#{RegistrazioneManagedBean.email}">

					<f:validateRegex
						pattern="^[_A-Za-z0-9-\+]+(\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9]+)*(\.[A-Za-z]{2,})$" />

				</p:inputText>
				<p:message for="email" />



				<h:outputLabel for="indirizzo">Indirizzo:</h:outputLabel>
				<p:inputText id="indirizzo" required="true" requiredMessage="Campo obbligatorio"
					value="#{RegistrazioneManagedBean.indirizzo}" />
				<p:message for="indirizzo" />
				
				<h:outputText value="Data di nascita: "  />
				<p:calendar id="cal" required="true" requiredMessage="Campo obbligatorio"
					value="#{RegistrazioneManagedBean.dataNascita2}" navigator="true" yearRange="1900:2015"
				 maxdate="#{RegistrazioneManagedBean.currentDate}"  />
				<p:message for="cal" />


			</h:panelGrid>

			<p:commandButton value="Registrati" update="regGrid"
				action="#{RegistrazioneManagedBean.registraUtente()}" />

		</p:panel>
		
			
		
	</h:form>
	
</body>
</html>